package com.pangu.util;

/**
 * 公共常量<br>
 * 本模块用的常量值范围为：0--1999;<br>
 * <p/>
 * Created by cxlin
 */
public interface MConstants {

    // 平台类型 ClientMark
    public static final int PLATFORM_PHO = 101;
    public static final int PLATFORM_PAD = 102;
    public static final int PLATFORM_TV = 103;

    // 客户端类型 ClientType
    public static final int CLIENT_TYPE_OTA = 0;
    public static final int CLIENT_TYPE_EXPER_A = 1;
    public static final int CLIENT_TYPE_EXPER_B = 2;

    // DES秘钥的数组, 对应的明文是"@2015pindanla!"
    // 计算方式为 (int) key.charAt(i) 的结果的数组
    public static final int[] COMMON_DES_KEY = {64, 50, 48, 49, 53, 112, 105, 110, 100, 108, 97, 33};

    // 签名因子
    public static final String CLIENT_UPDATE_DOWNLOAD_SIGN_FACTOR = "hiziyuan";

    // 无效ID
    public static final int NONE_ID = -49;
    // 无效ID
    public static final String NONE_STR_ID = "-49";

    // http headers
    public static final String H_CLIENT_MARK = "clientmark";
    public static final String H_SESSION_ID = "sessionid";
    public static final String H_VENDER = "vender";
    public static final String H_CHANNEL = "channel";
    public static final String H_DEVICE = "device";
    public static final String H_MAC = "mac";
    public static final String H_IMSI = "imsi";
    public static final String H_SDK_VERSION = "sdkversion";
    public static final String H_RESOLUTION = "resolution";
    public static final String H_DENSITY = "density";
    public static final String H_SER_TS = "ts";
    public static final String H_ABI = "abi";
    public static final String H_CLIENT_VERSION = "clientvname";
    public static final String H_CLIENT_VERSIONCODE = "clientvcode";
    public static final String H_ENCODED_CLIENT_PARAMS = "clientparams";
    public static final String H_USER_UUID = "useruuid";
    public static final String H_USER_ID = "userid";
    // 机型
    public static final String H_MODEL = "model";
    // 网络类型(文字描述)
    public static final String H_NET_TYPE = "nettype";
    // 网络类型(Android 定义整形值)
    public static final String H_NET_CODE = "netcode";
    // http header 是否是断点续传
    public static final int PARTIAL_NO = 0;
    public static final int PARTIAL_YES = 1;
    // 用来标记是否重试下载
    public static final String IS_RETRY_NO = "0";
    public static final String IS_RETRY_YES = "1";
    // 是否重试下载,重试下载时，不统计下载次数。
    public static final String H_IS_RETRY = "isretry";
    // http header 后端是需要更新下载数，只为一表示断点否则表示新下载
    public static final String H_DOWNLOAD_PARTIAL = "partial";
    //apikey
    public static final String H_API_KEY ="apikey";

    /**
     * 时间间隔
     */
    // 更新候选IP记录的时间间隔 6小时
    public static final long TIME_INTERVAL_UPDATE_CANDIDATE_ADDRESS_INFO = 6L * 1000 * 60 * 60L;
    // 网络请求相关
    // 默认的请求超时时间: 20s
    public static final int DEFAULT_CONNECTION_TIMEOUT = 20000;
    // 默认的读取超时时间: 20s
    public static final int DEFAULT_SO_TIMEOUT = 20000;
    // 默认的资源下载连接超时时间: 45s
    public static final int DEFAULT_RESOURCE_DOWNLOAD_CONNECTION_TIMEOUT = 45000;
    // 默认的资源下载读取超时时间: 45s
    public static final int DEFAULT_RESOURCE_DOWNLOAD_SO_TIMEOUT = 45000;
    // WAP网络资源下载读取超时时间: 60s
    public static final int WAP_RESOURCE_DOWNLOAD_SO_TIMEOUT = 60000;
    // 最大的环境重新数据初始化时间，这个用于控制内存相关数 15分钟
    // 1000 * 60 * 15
    public long maxContextReinit = 1000 * 60 * 15;
    // 任务超时间隔1小时,用于下拉刷新
    public long taskOverdue = 1000 * 60 * 60;

    // 消息终止
    public static final int M_MESSAGE_END = -494949;

    // 下载任务成功或失败
    public static final int DOWNLOAD_STATUS_SUCCESS = 0;
    public static final int DOWNLOAD_STATUS_COMMON_FAILURE = 1;
    public static final int DOWNLOAD_STATUS_SDCARD_FULL_FAILURE = 2;

    // 客户端自升级的下载SERVICE消息
    public static final String SERVICE_CLIENT_UPDATE_DOWNLOAD_REQUEST = "cn.pindanla.mob" +
            ".SERVICE_CLIENT_UPDATE_DOWNLOAD_REQUEST";
    public static final String SERVICE_CLIENT_UPDATE_DOWNLOAD_RETRY = "cn.pindanla.mob" +
            ".SERVICE_CLIENT_UPDATE_DOWNLOAD_RETRY";
    public static final String SERVICE_CLIENT_UPDATE_DOWNLOAD_CANCEL = "cn.pindanla.mob" +
            ".SERVICE_CLIENT_UPDATE_DOWNLOAD_CANCEL";
    public static final String SERVICE_CLIENT_UPDATE_DOWNLOAD_PAUSE = "cn.pindanla.mob" +
            ".SERVICE_CLIENT_UPDATE_DOWNLOAD_PAUSE";

    // 最优IP适配，候选地址查询GetAddressInfo
    public static final String ACTION_UPDATE_CANDIDATE_ADDRESS_INFO = "cn.pindanla.mob" +
            ".ACTION_UPDATE_CANDIDATE_ADDRESS_INFO";

    /**
     * 与状态相关的信息 （取值范围为100-499）
     */
    // 网络更改后的信息
    public static final int M_MOB_STATUS_NETWORKINFO_CHANGE = 100;
    // 请求遇到session超时
    public static final int M_MOB_STATUS_RESPONSE_SESSION_FAIL = 101;
    // 开始下载的消息
    public static final int M_MOB_STATUS_DOWNLOAD_START = 102;
    // 下载过程的普通失败
    public static final int M_MOB_STATUS_DOWNLAOD_COMMON_FAIL = 103;
    // SD卡不可写导致下载失败
    public static final int M_MOB_STATUS_DOWNLAOD_SDCARD_CANT_WRITE = 104;
    // SD卡满导致下载失败
    public static final int M_MOB_STATUS_DOWNLAOD_SDCARD_FULL = 105;
    // 客户端自升级开始下载
    public static final int M_MOB_STATUS_CLIENT_UPDATE_DOWNLOAD_START = 106;
    // 客户端自升级下载失败
    public static final int M_MOB_STATUS_CLIENT_UPDATE_DOWNLOAD_FAIL = 107;
    // 客户端自升级下载完成
    public static final int M_MOB_STATUS_CLIENT_UPDATE_DOWNLOAD_COMPLETE = 108;
    // 客户端自升级下载重试
    public static final int M_MOB_STATUS_CLIENT_UPDATE_DOWNLOAD_RETRY = 109;
    // 客户端自升级下载完成后发生其他错误，比如文件没有找到，下载的时候超界，MD5不对等
    public static final int M_MOB_STATUS_CLIENT_UPDATE_DOWNLOAD_ERROR = 110;
    // 客户端自升级下载取消
    public static final int M_MOB_STATUS_CLIENT_UPDATE_DOWNLOAD_CANCEL = 111;
    // 客户端自升级下载暂停
    public static final int M_MOB_STATUS_CLIENT_UPDATE_DOWNLOAD_PAUSE = 112;

    /**
     * 与操作相关的信息 （取值范围为500-999）
     */
    // 预先初始化
    public static final int M_MOB_ACTION_RELEASE_MEMARY = 500;

}
